<template>
    <div >
        <!--授权确认页面弹窗-->
        <el-dialog :visible.sync="visibleForm" v-if="visibleForm">
            <el-form ref="authForm" :model="authForm" class="formEmbedTable" :rules="rules">
                <table>
                    <caption>Auth Confirm</caption>
                    <tr>
                        <td>Auth No.:</td>
                        <td>
                            <el-form-item prop="authUserNo">
                                <el-input placeholder="input userNo." v-model="authForm.authUserNo"></el-input>
                            </el-form-item>
                        </td>
                    </tr>
                    <tr>
                        <td>password:</td>
                        <td>
                            <el-form-item prop="password">
                                <el-input v-model="authForm.password" type="password"></el-input>
                                <!--
                                <ynet-password v-model="authForm.password" :config="pwConfig" ref="password"></ynet-password>
                                -->
                            </el-form-item>
                        </td>
                    </tr>
                </table>
                <div class="btnArea mt20 tac">
                    <el-button type="primary" @click="submitForm()">Confirm</el-button>
                    <el-button @click="disableForm()">Cancle</el-button>
                </div>
            </el-form>
        </el-dialog>
        <!--授权确认页面弹窗end-->
    </div>
</template>
<script>
    import ghbIcon from '@src/components/icon'
    export default {
        name: 'authDialog',
        componentName: 'authDialog',
        props: {
            dialogTableVisible: { type: Boolean, default: false },
        },
        data(){
            return{
                visibleForm:false,
                authForm: { authUserNo: '', password: ''},//授权数据
                rules:{
                    authUserNo: [
                        {required: true, message: 'required', trigger: 'blur' },
                        { min: 1, max: 32, message: 'arrange 6 to 32', trigger: 'blur' },
                        {validator:this.$tools.validator.isNum,trigger:'blur', vm: this, formName: 'userInfo'}
                    ],
                    // password: [
                    //    { validator: this.$tools.validator.pwdValidator, vm: this, formName: 'authForm' },
                    //  ],
                },
                // pwConfig: {
                //     pgeId: "pgeId",
                //     initId: "initId"
                // },
            }
        },
        methods:{
            disableForm(){
                this.authForm.authUserNo=""
                this.authForm.password=""
                this.visibleForm=false;
                //this.dialogTableVisible=false;
            },
            submitForm(){
                //this.dialogTableVisible=false;
				//  this.$refs['authForm'].validate((valid)=>{
                //     if(valid){
                //         //this.dialogTableVisible=false;
                //         //this.authForm.randomField = this.$refs['password'].srandNum
                //     }
                // })
                this.dialogTableVisible=false;
                this.visibleForm=false;
                //console.log("authForm:"+JSON.stringify(this.authForm))
                this.$emit('getAuthForm',this.authForm)
            },
            show(){
                this.authForm.authUserNo=""
                this.authForm.password=""
                this.visibleForm=true;
            }
        }
    }
</script>